#include "Arduino.h"
#include "SwitchRailData.h"

/* CONSTRUCTOR */
SwitchRailData::SwitchRailData(byte id, int switchPort, int ledPort) {
  m_id = id;
  if(switchPort < SwitchRailData::minSwitchPort || switchPort > SwitchRailData::maxSwitchPort) {
    m_switchPort = 0U;
  }
  else
  {
    m_switchPort = switchPort;
  }
  
  if(ledPort < SwitchRailData::minLedPort || ledPort > SwitchRailData::maxLedPort) {
    m_ledPort = 0U;
  }
  else
  {
    m_ledPort = ledPort;
  }
}

// METHODES
/**
* \brief Get Switch rail data Id
* \param none
* \return Id
*/ 
byte SwitchRailData::getId() {
  return m_id;
}

/**
* \brief Get Switch rail data Port
* \param none
* \return switchPort
*/ 
int SwitchRailData::getSwitchPort() {
  return m_switchPort;
}

/**
* \brief Get Switch rail data LED Port
* \param none
* \return ledPort
*/ 
int SwitchRailData::getLEDPort() {
  return m_ledPort;
}
